local sk__tongtian = fk.CreateSkill {

  name = "sk__tongtian",

  tags = { Skill.Limited, },

}



sk__tongtian:addEffect("active", {
  name = "sk__tongtian",
  anim_type = "special",
  card_num = 0,
  target_num = 0,
  prompt = "#sk__tongtian",
  can_use = function(self, player)
    return player:usedSkillTimes(sk__tongtian.name, Player.HistoryGame) == 0
  end,
  card_filter = Util.FalseFunc,
  on_use = function(self, room, effect)
    local player = effect.from
    player:drawCards(4, sk__tongtian.name)
    if player.dead or player:isNude() then return end
    local success, dat = room:askForUseActiveSkill(player, "sk__tongtian_active", "#sk__tongtian-discard", true)
    if success and dat then
      local skills = {}
      for _, id in ipairs(dat.cards) do
        if Fk:getCardById(id).suit == Card.Spade then
          table.insert(skills, "ex__fankui")
        elseif Fk:getCardById(id).suit == Card.Heart then
          table.insert(skills, "ex__guanxing")
        elseif Fk:getCardById(id).suit == Card.Club then
          table.insert(skills, "wansha")
        elseif Fk:getCardById(id).suit == Card.Diamond then
          table.insert(skills, "ex__zhiheng")
        end
      end
      room:throwCard(dat.cards, sk__tongtian.name, player, player)
      if not player.dead then
        room:handleAddLoseSkills(player, skills, nil, true, false)
      end
    end
  end
})

return sk__tongtian